import { CoolController, BaseController } from '@cool-midway/core';
import { InventoryEntity } from '../../entity/inventory';
import { Inject, Provide } from '@midwayjs/decorator';
import { Repository } from 'typeorm';
import { InjectEntityModel } from '@midwayjs/typeorm';
import { InventoryService } from '../../service/inventory';

@Provide()
@CoolController({
  api: ['delete', 'update', 'info', 'list', 'page'],
  entity: InventoryEntity,
  listQueryOp: {
    fieldEq: ['warehousing_time'],
    keyWordLikeFields: ['product_code'],
  },
  pageQueryOp: {
    fieldEq: ['warehousing_time'],
    keyWordLikeFields: ['product_code'],
  },
})
export class APIController extends BaseController {
  @InjectEntityModel(InventoryEntity)
  inventoryEntity: Repository<InventoryEntity>;

  @Inject()
  inventoryService: InventoryService;
}
